<form action="" class="form-horizontal" role="form">

	<div class="form-group">
	    <label class="col-sm-2 control-label">栏目排序</label>
	    <div class="col-sm-2">
	    	<input type="number" class="form-control" name="sort" min="0" />
	    </div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label">父栏目</label>
		<div class="col-sm-2">
			<input type="hidden" name="pid" value="{$_GET['id']}"/>
			<select class="form-control" name="pid">{$productCategoryOptions}</select>
		</div>
	</div>
	
	<div class="form-group">
	    <label class="col-sm-2 control-label">栏目名称</label>
	    <div class="col-sm-2">
	    	<input type="text" class="form-control" name="name" datatype="*"/>
	    </div>
	</div>
	
	<div class="form-group">
	    <label class="col-sm-2 control-label">栏目Logo</label>
	    <div class="col-sm-4">
	    	<div class="image-result-content">
	    		<img id="logo-result" class="margin-bottom" />
	    	</div>
	    	<input type="text" id="logo" name="logo" class="form-control margin-bottom" />
			<input type="file" name="logo_upload" id="logo_upload" />
	    </div>
	</div>
	
	<div class="form-group">
	    <label class="col-sm-2 control-label">栏目图片</label>
	    <div class="col-sm-4">
	    	<div class="image-result-content">
	    		<img id="image-result" class="margin-bottom" />
	    	</div>
	    	<input type="text" id="image" name="image" class="form-control margin-bottom" />
			<input type="file" name="image_upload" id="image_upload" />
	    </div>
	</div>
	
	<div class="form-group">
		<div class="col-sm-offset-2 col-sm-8">
			<a class="btn btn-default" onclick="javascript:history.go(-1)">返回上页</a>
			<a class="btn btn-default" onclick="self.location=document.referrer">返回上页并刷新</a>
			<button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/addPost">保存更改</button>
		</div>
	</div>
</form>

<style type="text/css">
	.image-result-content {
		max-height: 50px;
		overflow: hidden;
		margin-bottom: 5px;
	}
	#image-result,#logo_result {
		max-height: 50px;
	}
</style>

<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/uploadify/uploadify.css">
<script type="text/javascript" src="__PUBLIC__/Style/Common/uploadify/jquery.uploadify.min.js?{:rand(0,9999)}"></script>
<script type="text/javascript">
$(function() {
    $("#logo_upload").uploadify({
        'multi'			:	false,
        'fileSizeLimit' : 	'200kb',
        'buttonText'	:	'选择图片',
        'fileTypeDesc' 	: 	'Image Files',
        'fileTypeExts' 	: 	'*.jpg; *.png',
        'swf'			: 	'__PUBLIC__/Style/Common/uploadify/uploadify.swf',
        'uploader'		: 	'__MODULE__/Upload/uploadOne',
        'onUploadSuccess'	: function(data, res){
        	
        	var url = eval("(" + res + ")").extra.url;
        	$("#logo-result").attr("src", url);
        	$("#logo").val( url );
        	
        }
    });
    $("#image_upload").uploadify({
        'multi'			:	false,
        'fileSizeLimit' : 	'200kb',
        'buttonText'	:	'选择图片',
        'fileTypeDesc' 	: 	'Image Files',
        'fileTypeExts' 	: 	'*.jpg; *.png',
        'swf'			: 	'__PUBLIC__/Style/Common/uploadify/uploadify.swf',
        'uploader'		: 	'__MODULE__/Upload/uploadOne',
        'onUploadSuccess'	: function(data, res){
        	
        	var url = eval("(" + res + ")").extra.url;
        	$("#image-result").attr("src", url);
        	$("#image").val( url );
        	
        }
    });
});
</script>

<!-- ueditor -->
<link rel="stylesheet" href="/ue/themes/default/css/ueditor.min.css">
<script type="text/javascript" src="/ue/ueditor.config.js"></script>
<script type="text/javascript" src="/ue/ueditor.all.js"></script>
<script type="text/javascript">
	window.UEDITOR_HOME_URL = "/ue/";
    
    var editor = UE.getEditor("category-page",{
    	initialFrameWidth: "100%",
	    initialFrameHeight: 300,
	    textarea: "content"
    });
    
</script>